//暴露(使用路由懒加载配置路由)
export default [
    //主页
    {
        name:'Home',
        path: '/home',
        component:()=>import ('@/pages/Home'),
        meta:{bgColor:'white'}
    },
    //登录
    {   
        name:'Login',
        path:'/login',
        component:()=>import('@/pages/Login'),
        meta:{bgColor:'white'}
    },
    //注册
    {
        name:'Register',
        path:'/register',
        component:()=>import('@/pages/Register'),
        meta:{bgColor:'white'}
    },
    //个人中心
    {
        name:'PersonalCenter',
        path:'/personalCenter',
        component:()=>import('@/pages/PersonalCenter'),
        redirect:'/personalCenter/trem',
        meta:{bgColor:'black'},
        children:[
            {
                //首页
                name:'Term',
                path:'trem',
                component:()=>import('@/pages/PersonalCenter/Term'),
                meta:{bgColor:'black'}
            },
            {
                //评价
                name:'Appraise',
                path:'appraise',
                component:()=>import('@/pages/PersonalCenter/Appraise'),
                meta:{bgColor:'black'}
            },
            {
                //收藏
                name:'Collect',
                path:'collect',
                component:()=>import('@/pages/PersonalCenter/Collect'),
                meta:{bgColor:'black'}
            },
            {
                //签到
                name:'SignIn',
                path:'signIn',
                component:()=>import('@/pages/PersonalCenter/SignIn'),
                meta:{bgColor:'black'}
            },
            {
                //图片
                name:'Picture',
                path:'picture',
                component:()=>import('@/pages/PersonalCenter/Picture'),
                meta:{bgColor:'black'}
            },
            {
                //攻略
                name:'Strategy',
                path:'strategy',
                component:()=>import('@/pages/PersonalCenter/Strategy'),
                meta:{bgColor:'black'}
            },
            {
                //帖子
                name:'Invitation',
                path:'invitation',
                component:()=>import('@/pages/PersonalCenter/Invitation'),
                meta:{bgColor:'black'}
            }
        ]
    },
    //消息
    {
        name:'Message',
        path:'/message',
        component:()=>import('@/pages/Message'),
        redirect:'/message/remind',
        meta:{bgColor:'black'},
        children:[
            {   //提醒
                name:'Remind',
                path:'remind',
                component:()=>import('@/pages/Message/Remind'),
                meta:{bgColor:'black'}
            },
            {   //互动
                name:'Interact',
                path:'interact',
                component:()=>import('@/pages/Message/Interact'),
                meta:{bgColor:'black'}
            },
            {   //订阅
                name:'Subscribe',
                path:'subscribe',
                component:()=>import('@/pages/Message/Subscribe'),
                meta:{bgColor:'black'}
            }
        ]
    },
    //预约订位
    {
        name:'Orderseat',
        path:'/orderseat',
        component:()=>import('@/pages/Orderseat'),
        meta:{bgColor:'white'}
    },
    //评论操作页面
    {
        name:'Evaluate',
        path:'/evaluate',
        component:()=>import ("@/pages/Evaluate"),
        meta: { bgColor: 'white' },
            beforeEnter: (to, from, next) => { // 路由前置守卫
        // 如果还没有登陆,跳转到首页 
                
        if (!localStorage.getItem("isLogin")) {
        next('/home')
        } else {
        // 如果已经登陆, 放行
        next()
        }
        } 
    },
    //饭店详情页面
    {
        name:'Detai',
        path:'/detail',
        component:()=>import('@/pages/Detail'),
        meta: { bgColor: 'white' }
    
    },
    //搜索页面
    {
        //params参数占位可传可不传
        name:'/search/:keyword?',
        path: '/search',
        component: () => import('@/pages/Search'),
        meta:{bgColor:'white'}
    },
    //重定向
    {
        path:'/',
        redirect:"home",
    }
]
